import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yysk_app/pages/nft_pages/home_pages/news_detail/news_detail_page.dart';
import 'package:yysk_app/utils/helper.dart';
import 'package:yysk_app/widget/lazy_network_image.dart';


class NewsItemWidget extends StatelessWidget {
  final String? stateImage;
  final String? stateName;
  final String? stateDate;
  final int? stateId;
  const NewsItemWidget(
      {super.key,
      this.stateImage,
      this.stateName,
      this.stateDate,
      this.stateId});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Get.toNamed(
          '${NewsDetailPage.path}?id=$stateId',
          arguments: {'id': stateId},
        );
      },
      child: Stack(
        children: [
          ClipRRect(
             borderRadius: BorderRadius.circular(22.px),
             child:  Container(
            height: 192.px,
            clipBehavior: Clip.antiAlias,
            decoration: BoxDecoration(
              
              // color: Colors.yellow,
                borderRadius: BorderRadius.circular(22.px),
            ),
           child: Column(
            children: [
              LazyImage(imageUrl: '$stateImage',width: context.width,height: 120,borderRadius: 0,boxFit: BoxFit.fitWidth,)
            ],
           ),
          ),
          ),
         
          Positioned(
            left: 0,
            right: 0,
            bottom: 0,
            child: Container(
              height: 72.px,
              // clipBehavior: Clip.antiAlias,
              decoration: BoxDecoration(
                color: const Color(0xff141414),
                border: Border.all(color: Colors.white12, width: 1),
                borderRadius: BorderRadius.only(
                  bottomLeft: Radius.circular(22.px),
                  bottomRight: Radius.circular(22.px),
                ),
              ),
              child: Padding(
                padding: EdgeInsets.all(12.px),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      '$stateName' ,
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 16.px,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    hiSpace(height: 4.px),
                    Text(
                      stateDate ?? '',
                      style: TextStyle(
                        color: Colors.white.withOpacity(0.7),
                        fontSize: 12.px,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          )
        ],
      ),
    );
  }
}
